package com.fanfanwang.ffw.app.net;

import java.util.LinkedHashMap;

import org.json.JSONException;

import com.fanfanwang.ffw.app.bean.SucChksmsBean;
import com.fanfanwang.ffw.app.bean.SucGetAppVersionBean;
import com.fanfanwang.ffw.app.bean.SucGetCityListBean;
import com.fanfanwang.ffw.app.bean.SucGetDianListBean;
import com.fanfanwang.ffw.app.bean.SucGetLengthListBean;
import com.fanfanwang.ffw.app.bean.SucGetNewsInfoBean;
import com.fanfanwang.ffw.app.bean.SucGetNewsListBean;
import com.fanfanwang.ffw.app.bean.SucGetOrdersInfoBean;
import com.fanfanwang.ffw.app.bean.SucGetOrdersListBean;
import com.fanfanwang.ffw.app.bean.SucGetParkListBean;
import com.fanfanwang.ffw.app.bean.SucGetParkingInfoBean;
import com.fanfanwang.ffw.app.bean.SucGetUserInfoBean;
import com.fanfanwang.ffw.app.bean.SucGetYuYueListBean;
import com.fanfanwang.ffw.app.bean.SucGetparkingListBean;
import com.fanfanwang.ffw.app.bean.SucIsRegBean;
import com.fanfanwang.ffw.app.bean.SucIsRegReturnBean;
import com.fanfanwang.ffw.app.bean.SucLoginBean;
import com.fanfanwang.ffw.app.bean.SucOrderDoneBean;
import com.fanfanwang.ffw.app.bean.SucRegBean;
import com.fanfanwang.ffw.app.bean.SucSaveFeedbackBean;
import com.fanfanwang.ffw.app.bean.SucSetNewPasswordBean;
import com.fanfanwang.ffw.app.bean.SucSetPasswordBean;
import com.fanfanwang.ffw.app.bean.SucUpdateMobileBean;
import com.fanfanwang.ffw.app.bean.SucUpdateUserinfoBean;
import com.fanfanwang.ffw.app.common.LogUtil;

import android.content.Context;

public class IssNetLib {
	private static IssNetLib mLib;
	private FfwParse mParse;
	XSHttpService xsHttpService;

	private IssNetLib(Context context) {
		xsHttpService = new XSHttpService();
		mParse = new FfwParse();
	}

	public synchronized static IssNetLib getInstance(Context context) {
		if (mLib == null) {
			mLib = new IssNetLib(context);
		}
		return mLib;
	}

	//	//得到我参与的一元抢购
	//	public SucMyOneYuanBean getMyOneyuanlist(String methodName,
	//			LinkedHashMap<String, Object> paramsMap) {
	//		String json = xsHttpService.requestExtension(methodName, paramsMap);
	//		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
	//		return FfwParse.parseMyOneYuanBean(json);
	//	}
	/**
	 * 登录
	 * */
	public SucLoginBean getLogin(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestLogin(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseLogin(json);
	}
	/**
	 * 注册
	 * */
	public SucRegBean getReg(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestReg(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseReg(json);
	}
	/**
	 * iii.	isreg用户检测
	 * */
	public SucIsRegBean getIsreg(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestIsReg(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseIsReg(json);
	}
	/**
	 *viii.	isregReturn 用户找回密码验证码发送
	 * */
	public SucIsRegReturnBean getIsregReturn(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestIsRegReturn(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseIsRegReturn(json);
	}
	/**
	 * iv.	chksms验证短信验证码
	 * */
	public SucChksmsBean getChksms(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestChksms(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseChecksms(json);
	}
	/**
	 * v.	updateMobile修改用户手机号
	 * */
	public SucUpdateMobileBean getUpdateMobile(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestUpdateMobile(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseUpdateMobile(json);
	}
	/**
	 * vi.	updateUserinfo修改用户基本资料
	 * */
	public SucUpdateUserinfoBean getUpdateUserinfo(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestUpdateUserinfo(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseUpdateUserinfo(json);
	}
	/**
	 * vii.	getUserInfo获取用户基本资料 
	 * */
	//TODO 
	public SucGetUserInfoBean getUserInfo(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestGetUserInfo(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseGetUserInfo(json);
	}
	/**
	 * viii.	setPassword修改用户密码
	 * */
	public SucSetPasswordBean setPassword(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestSetPassword(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseSetPassword(json);
	}
	/**
	 * ix.	setNewPassword设置用户新密码
	 * */
	public SucSetNewPasswordBean setNewPassword(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestSetNewPassword(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseSetNewPassword(json);
	}
	/**
	 * x.	saveFeedback用户意见反馈
	 * */
	public SucSaveFeedbackBean saveFeedback(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestSaveFeedback(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseSaveFeedback(json);
	}
	/**
	 *i.	getparkingList获取当前位置停车场数组
	 * */
	public SucGetparkingListBean getparkingList(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestGetparkingList(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseGetparkingList(json);
	}
	/**
	 *ii.	getCityList获取区域列表
	 * */
	public SucGetCityListBean getCityList(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestGetCityList(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseCityList(json);
	}
	/**
	 *iii.	getLengthList获取搜索距离数组
	 * */
	public SucGetLengthListBean getLengthList(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestGetLengthList(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseGetLengthList(json);
	}
	/**
	 *iv.	getParkList获取指定路段停车场列表
	 * */
	public SucGetParkListBean getParkList(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestGetParkList(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseGetParkList(json);
	}
	/**
	 *v.	getParkingInfo获取指定停车场详细信息
	 * */
	public SucGetParkingInfoBean getParkingInfo(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestGetParkingInfo(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseGetParkingInfo(json);
	}
	/**
	 *vi.	getDianList获取洗车店、4S店、加油站列表
	 * */
	public SucGetDianListBean getDianList(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestGetDianList(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseGetDianList(json);
	}
	/**
	 *vii.	order_done预约停车位
	 * */
	public SucOrderDoneBean orderDone(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestOrderDone(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseOrderDone(json);
	}
	/**
	 *viii.	getNewsList获取汽车资讯列表
	 * */
	public SucGetNewsListBean getNewsList(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestGetNewsList(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseGetNewsList(json);
	}

	/**
	 *ix.	getNewsInfo获取汽车资讯详细信息
	 * */
	public SucGetNewsInfoBean getNewsInfo(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestGetNewsInfo(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseGetNewsInfo(json);
	}

	/**
	 *i.	getOrdersList获取预约记录
	 * */
	public SucGetOrdersListBean getOrdersList(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestGetOrdersList(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseGetOrdersList(json);
	}

	/**
	 *ii.	getOrdersInfo获取预约记录详情
	 * */
	public SucGetOrdersInfoBean getOrdersInfo(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestGetOrdersInfo(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseGetOrdersInfo(json);
	}

	/**
	 *ii.	getAppVersion获取手机版本信息
	 * */
	public SucGetAppVersionBean getAppVersion(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestGetAppVersion(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseGetAppVersion(json);
	}
	
	/**
	 *viii.	getYuyueList获取用户当天有效预约记录	
	 * */
	public SucGetYuYueListBean getYuyueList(String methodName,
			LinkedHashMap<String, Object> paramsMap) throws JSONException {
		String json = xsHttpService.requestGetYuyueList(methodName, paramsMap);
		LogUtil.e("IssNetLib", "getMyAuction    >>>>" + json);
		return FfwParse.parseGetYuyueList(json);
	}
}
